<?php 
class CWestinfo extends Zend_Db_Table
{
	protected $_name;
	protected $_primary;
	public function __construct()
	{
		$this->_name=R_PRE. "west_info";
		$this->_primary = 'info_id';
		parent::__construct();
	}

	public function updateInfo($orderid, $mtcn, $sendname)
	{
		if ($this->exist($orderid)) {
			return $this->update(array('mtcn'=>$mtcn, 'send_name'=>$sendname), 'orderid = ' . intval($orderid));
		} else {
			return $this->insert(array('mtcn'=>$mtcn, 'send_name'=>$sendname, 'orderid'=>$orderid, 'addtime'=>time()));
		}
	}
	
	public function exist($id)
	{
		return $this->fetchRow(array('orderid = ?'=>$id));
	}
}